Fix reboot logic. An indentation error meant that every second reboot would
authoremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Fri, 28 Oct 2005 12:02:06 +0000 (13:02 +0100)
committeremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Fri, 28 Oct 2005 12:02:06 +0000 (13:02 +0100)
be refused, with the domain being destroyed instead.

Further fix for reboot logic when using on_reboot=rename-restart: the incorrect
node was being removed once restart has completed, leaving Xend to conclude
later that it had crashed in the middle of a restart.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/python/xen/xend/XendDomainInfo.py

index 999716219d56ab4c6fa1a6eb3adcf4928e246763..7e2199ec6e4be58d926f128f87825d80cbbd6fad 100644 (file)
@@ -1275,7 +1275,6 @@ class XendDomainInfo:
 
         now = time.time()
         rst = self.readVm('xend/previous_restart_time')
-        log.error(rst)
         if rst:
             rst = float(rst)
             timeout = now - rst
@@ -1284,8 +1283,8 @@ class XendDomainInfo:
                     'VM %s restarting too fast (%f seconds since the last '
                     'restart).  Refusing to restart to avoid loops.',
                     self.info['name'], timeout)
-            self.destroy()
-            return
+                self.destroy()
+                return
 
         self.writeVm('xend/previous_restart_time', str(now))
 
@@ -1306,7 +1305,11 @@ class XendDomainInfo:
             except:
                 log.exception('Failed to restart domain %d.', self.domid)
         finally:
-            self.removeVm('xend/restart_in_progress')
+            # new_dom's VM will be the same as this domain's VM, except where
+            # the rename flag has instructed us to call preserveForRestart.
+            # In that case, it is important that we use new_dom.removeVm, not
+            # self.removeVm.
+            new_dom.removeVm('xend/restart_in_progress')
             
         # self.configure_bootloader()
         #        self.exportToDB()